public class Buyer
{
    public static car  getCarInstanceByType(String carname){
    car instanceOfcarReturned = null;
    if ( carname.equalsIgnoreCase("宝马") ){
        instanceOfcarReturned = new BaomaEntity();
    }else if (carname.equals("奔驰")){
        instanceOfcarReturned = new BenchiEntity();
    } else if (carname.equals("法拉利")) {
        instanceOfcarReturned = new FalaliEntity();
    }
    return  instanceOfcarReturned;
}
}
